/*
 * @Author: David Ma
 * @FilePath: \huaxia-real-estate-web\src\hooks\loading.ts
 * @LastEditors: David Ma
 * @Description: 该文件用于定义loading相关的hooks
 * @Date: 2024-01-01 22:12:04
 */
export default function useLoading(initValue = false) {
    const loading = ref(initValue);
    // 设置loading
    const setLoading = (value: boolean) => {
        loading.value = value;
    };
    // 切换loading
    const toggle = () => {
        loading.value = !loading.value;
    };
    // 返回
    return {
        loading,
        setLoading,
        toggle,
    };
}
